 $(".edita").click(function(){
	        //获取当前点击
	           trobj= $(this).parents('tr');
	           pid = trobj.find("td:eq(0)").text()
			   petimgtd = trobj.find("td:eq(1)")
	           pname = trobj.find("td:eq(2)").text()
	           oname = trobj.find("td:eq(3)").text()
	           address= trobj.find("td:eq(4)").text()
	           ability = trobj.find("td:eq(5)").text()
	           pclass = trobj.find("td:eq(6)").text()
			   
			   msgtd = trobj.find("td:eq(7)")
			   petmsg = msgtd.find("input:eq(0)").val()
			   pet_his = msgtd.find("input:eq(1)").val()
			   pet_fit = msgtd.find("input:eq(2)").val()
			   
			   datatd = trobj.find("td:eq(9)")
			   bueaty = datatd.find("input:eq(0)").val()
			   pet_clingy = datatd.find("input:eq(1)").val()
			   pet_kind = datatd.find("input:eq(2)").val()
			   pet_smart = datatd.find("input:eq(3)").val()
			   pet_honest = datatd.find("input:eq(4)").val()
			
			var petimg = petimgtd.find('img')
			var petimg_copy= petimg.clone()
			petimg_copy.css('width','40%')
			petimg_copy.addClass('replaceimg') //添加class类名
			var imgshow = $('#imgContaineru').find('img')
			  imgshow.replaceWith(petimg_copy)
		
	           $('#pidu').val(pid)
			   $('#pidu2').val(pid)
	           $('#pnameu').val(pname)
	           $('#onameu').val(oname)
	           $('#addressu').val(address)
	           $('#abilityu').val(ability)
	           $('#pclassu').val(pclass)
			   $('#petmsgu').val(petmsg)
			   $('#pet_hisu').val(pet_his)
			   $('#pet_fitu').val(pet_fit)
			   $('#bueatyu').val(bueaty)
			   $('#pet_clingyu').val(pet_clingy)
			   $('#pet_kindu').val(pet_kind)
			   $('#pet_smartu').val(pet_smart)
			   $('#pet_honestu').val(pet_honest)
			   
	    })
	
	                $("#submitbut2").click(function(){
	                        $("#modbut").click()
	                });
	})
/* 更换宠物图片 */	
	var fileInput = document.getElementById('petimgu');
	
	  function showImgu(obj) {
	    var files = obj.files
	    document.getElementById("imgContaineru").innerHTML = getImgsByUrl(files)
	  }
		 //获取图像元素
	  function getImgsByUrl(files) {
	    var elements = ''
	    for (var i = 0; i < files.length; i++) {
	      var url = window.URL.createObjectURL(files[i])
	      elements += "<img src='" + url + "' style='width: 40%; height: 40%;' class='changeimg'/>"
	    }
	    return elements
	  }
		//清除修改图片
					 function clearupdate(){
						 var addimg = document.getElementsByClassName('changeimg')
						 var replaceimg= document.getElementsByClassName('replaceimg')
						 try{
							addimg.item(addimg).remove()
						 }catch(err){ 
							 console.log(err)
						 }
						 
					try{replaceimg.item(replaceimg).remove()}
					 catch(err){
						  console.log(err)
					 }
					  fileInput.value = null;  
	                                 }